package com.rykj.ruiyan_ptz.ui

import android.os.Bundle
import com.rykj.common.ui.BaseActivity
import com.rykj.ruiyan_ptz.R
import io.reactivex.Observable
import io.reactivex.android.schedulers.AndroidSchedulers
import io.reactivex.disposables.Disposable
import io.reactivex.schedulers.Schedulers
import java.util.concurrent.TimeUnit

class SplashActivity : BaseActivity() {
    private var subscribe: Disposable? = null
    override fun getLayoutId(): Int {
        return R.layout.activity_splash
    }

    override fun isFullScreen(): Boolean {
        return true
    }

    override fun init(savedInstanceState: Bundle?) {
        subscribe = Observable.interval(0, 1, TimeUnit.SECONDS, Schedulers.newThread())
            .observeOn(AndroidSchedulers.mainThread())
            .subscribe { aLong: Long ->
                if (aLong == 3L) {
                    subscribe!!.dispose()
                    LoginActivity.start(this)
                    finish()
                }
            }
    }

}